// src/api/dashboardApi.js
import axios from 'axios';

//所有请求改用 /api 开头（走代理），不再直接写 `http://localhost:5011`
// const API_BASE_URL = '/api';
const API_BASE_URL = '';

export const getBasicDataGovernanceAsync = async (type) => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetBasicDataGovernanceAsync`,
    {
      params: {
        type: type,
      },
    },
  );
};

export const getDepartmentsAsync = async () => {
  return axios.get(`${API_BASE_URL}/api/library/BigScreen/GetDepartmentsAsync`);
};

export const getCurrentMonthForwardAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetCurrentMonthForwardAsync`,
  );
};

//1-获取基础数据治理
export const getBasicDataGovernanceByBuAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetBasicDataGovernanceByBuAsync`,
  );
};

export const getBasicDataGovernanceByTrendAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetBasicDataGovernanceByTrendAsync`,
  );
};

//2-获取获取项目交付
export const getProjectDeliveryByBuAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetProjectDeliveryByBuAsync`,
  );
};

export const getProjectDeliveryByTrendAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetProjectDeliveryByTrendAsync`,
    {
      params: {
        drawType: '004',
      },
    },
  );
};

//3-获取数字化应用(每月)
export const getDigitalApplicationsByBuAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetDigitalApplicationsByBuAsync`,
  );
};
export const getDigitalApplicationsByTrendAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetDigitalApplicationsByTrendAsync`,
  );
};
export const getDigitalApplicationsByUsuageAsync = async () => {
  return axios.get(
    `${API_BASE_URL}/api/library/BigScreen/GetDigitalApplicationsByUsuageAsync`,
  );
};
